package day06;


public class MethodDemo {
    public static void main(String[] args) {

        sayHello("MCF",22);
        sayHello("MMM",61);

        /*
        int[] a = testArray(5,100);
        System.out.println(a.length);
        System.out.println("第一个元素为:"+a[0]);

        int[] b = testArray(20,100);
        for (int i=0;i<b.length;i++){
            System.out.println(b[i]);
        }
         */

        /*
        say();
        System.out.println("继续执行...");

        sayHi("MCF");
        System.out.println("继续执行...");

        sayHello("JCL",24);
        System.out.println("继续执行...");

        double a = getNum();
        System.out.println(a);

         */

        aMethod();
        System.out.println("444");
    }

    public static void aMethod(){
        System.out.println("111");
        bMethod();
        System.out.println("333");
    }

    public static void bMethod(){
        System.out.println("222");
    }

    public static int[] testArray(int len,int max){
        int[] arr = new int[len];
        for (int i=0;i<arr.length;i++){
            arr[i] = (int)(Math.random()*(max+1));
        }
        return arr;
    }

    /*
    public static int[] testArray(){
        int[] arr = new int[10];
        for (int i=0;i<arr.length;i++){
            arr[i] = (int)(Math.random()*100);
        }
        return arr;
    }
     */

    public static void say(){
        System.out.println("大家好，我叫...");
    }

    public static void sayHi(String name){
        System.out.println("大家好，我叫"+name+"，今年22岁...");
    }

    public static void sayHello(String name,int age){
        if (age>60){
            return;
        }
        System.out.println("大家好，我叫"+name+"，今年"+age+"岁...");
    }

    public static double getNum(){
        return 8.88;
    }

}
